<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<title>更新用户信息</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script th:src="@{/util/util.js}"></script>
<script>
	$(function(){
		/* jQuery.validator.addMethod('isKey', function(value, element) {
			var length = value.length;
			var key = /^[0-9a-zA-Z`~!@#$%\^&*\(\)-_+={}|\[\]\;\'\:\"\,\.\\\/\?]{16}$/;
			return (length == 16 && key.test(value));
		}, 'key必须是由16位字母、数字、下划线或特殊符号组成');
		 */
		$.validator.addMethod('isKey', function (value, element) {
			var length = value.length;
			var key = /^[0-9a-zA-Z`~!@#$%\^\&\*\(\)\-\_\+\=\{\}\|\[\]\;\'\:\"\,\.\\\/\?]{16}$/;
			if(!(length == 16 && key.test(value))) {
				 $(element).data('error-msg','key必须是由16位字母、数字、下划线或特殊符号组成');
			     return false;
			}
			var key2 = /^([0-9]{16})|([a-zA-Z]{16})|([`~!@#$%\^\&\*\(\)\-\_\+\=\{\}\|\[\]\;\'\:\"\,\.\\\/\?]{16})$/;
			if(key2.test(value)) {
				$(element).data('error-msg','key值过于简单');
				return false;
			}
		    return true;
		}, function(params, element) {
		    return $(element).data('error-msg');
		});
	});
	
</script>
<style>
	.select2-container .select2-selection--single {
		height:36px;
	}
	.select2-container--default .select2-selection--single {
		border-color: #d2d6de;
	}
</style>
</head>
<body>
	<div id="msg"></div>
	<form role="form" id="userForm" data-th-action="@{/addUser}" data-th-object="${user}" data-th-method="post">
		<div class="box-body">
			<input type="hidden" data-th-field="*{id}" name="id"/>
			<input type="hidden" data-th-field="*{state}" name="state"/>
			<input type="hidden" data-th-field="*{delFlag}" name="delFlag"/>
			<input type="hidden" data-th-field="*{remark}" name="remark"/>
             <div class="form-group">
               <label for="username">用户名</label>
               <input type="text" readonly="readonly" required autocomplete="off" class="form-control" name="username" id="username" data-th-field="*{username}" placeholder="输入用户名"/>
               <label id="userNameMsg" style="display:none;"></label>
             </div>
             <div class="form-group">
               <label for="userKey">key</label>
               <input type="text" required class="form-control isKey isSimpleKey" name="userKey" id="userKey" data-th-field="*{userKey}" placeholder="输入key"/>
             </div>
        </div>
	</form>
</body>
</html>